package com.centriole.service.workflow.service.shiro;

import com.centriole.common.entity.ExRole;
import com.centriole.service.workflow.entity.shiro.Role;
import com.centriole.service.workflow.service.feign.ExUserClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 *
 *  功   能：Mock Service ，Role
 *  创建人：陈默晗
 *  时   间：2018年1月4日上午10:58:02
 */
@Service
public class IRoleService{

	@Autowired
    ExUserClient exUserClient;
	/*
	public static List<Permission> rolePermissionListByAdmin = Arrays.asList(new Permission[] {
			new Permission("权限管理", "/perms/**", "admin:perms"),
			new Permission("角色管理", "/role/**", "admin:role"),
			new Permission("日志管理", "/html/logLost.jsp", "admin:log"),
	});

	public static List<Permission> rolePermissionListByNormal = Arrays.asList(new Permission[] {
			new Permission("用户展示", "/user/main", "user:main")
	});
	
	private static final List<Role> roleList = Arrays.asList(new Role[]{
			new Role(1L,"管理员",rolePermissionListByAdmin),
			new Role(2L,"一般用户",rolePermissionListByNormal),
	});
	*/
	@Transactional
	public void add(Role t) {

	}

	@Transactional
	public void update(Role t) {

	}


	public List<Role> getAll() {
		List<ExRole> roleList = exUserClient.listAllExRoles();
		return UserShiroConvertor.toIRoleList(  roleList  );
	}


	@Transactional
	public void removeRole(Long roleId) {

	}


}
